package com.jackeysun.app_widget

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.lifecycle.lifecycleScope
import com.jackeysun.app_widget.databinding.ActivityMainBinding
import com.jackeysun.widget.LoadingDialog
import com.jackeysun.widget.LoadingView
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch

class MainActivity : AppCompatActivity() {

    val loading :LoadingDialog by lazy { LoadingDialog(this) }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val mainBinding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(mainBinding.root)
        mainBinding.btn.setProgress(progress = 80)

        lifecycleScope.launchWhenResumed {
            loading.show()
            delay(3000)
            loading.dismiss()
        }
    }
}